<%var csstpl = {%>

    <%};%>
        <%var jstpl = {%>
            <script>
                var app = new Vue({
                    el: "#content",
                    data: {
                        query: {
                            agent_id: '${agentId}',
                            pageNumber: 1,
                            pageSize: 10
                        },
                        data_result: []
                    },
                    created: function() {
                        this.loadPage("init")
                    },
                    mounted() {
                        let form = layui.form;
                        let that = this;
                    },
                    methods: {
                        loadPage: function(model) { //载入模式有两种  init初始化载入 load分页载入
                            if (model == "init") {
                                this.query.pageNumber = 1;
                            }
                            Ajax("/system/agent/accountList", this.query, function(d) {
                                console.log(d);
                                app.data_result = d.list;
                                if (d.firstPage == true) {
                                    layui.laypage.render({
                                        elem: 'gexin_page' //注意，这里的 test1 是 ID，不用加 # 号
                                            ,
                                        layout: ['count', 'prev', 'page', 'next',
                                            'limit', 'skip'
                                        ],
                                        count: d.totalRow //数据总数，从服务端得到
                                            ,
                                        limit: app.query.pageSize,
                                        jump: function(obj, first) {
                                            app.query.pageNumber = obj.curr;
                                            if (app.query.pageSize != obj.limit) {
                                                app.query.pageSize = obj.limit;
                                                app.loadPage("init");
                                                return;
                                            }
                                            if (!first) {
                                                app.loadPage("load");
                                            }
                                        }
                                    });
                                }
                            })
                        }
                    }
                })
            </script>
            <%};%>
                <%layout("../layout/_layout_layui.html",{title:"代理商管理",jstpl:jstpl,csstpl:csstpl}){%>
                    <div class="layui-row" id="content" v-cloak>
                        <div class="layui-col-md10">
                            <div class="layui-form-item ">
                                <div class="layui-input-inline">
                                    <input type="text" v-model="query.name" placeholder="输入代理商名称模糊查询" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-input-inline">
                                    <input type="text" v-model="query.phone" placeholder="输入联系电话模糊查询" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-col-md2">
                            <div class="layui-form-item">
                                <a @click="loadPage" class="layui-btn"><i class="layui-icon">&#xe615;</i> 查询/筛选</a>
                            </div>
                        </div>

                        <div class="layui-col-md12" style="margin-top: 20px">
                            <table class="layui-table ">
                                <thead>
                                    <tr>
                                        <th>流水单号</th>
                                        <th>金额</th>
                                        <th>操作时间</th>
                                        <th>交易类型</th>
                                    </tr>
                                </thead>
                                <tbody v-for="d in data_result">
                                    <tr>
                                        <td>{{d.id}}</td>
                                        <td>{{d.state==0?'-':'+' }}{{d.price }}</td>
                                        <td>{{d.create_time}}</td>
                                        <td>{{d.type==1?'首次审核':d.type==2?'用户充值':d.type==3?'用户提现':d.type==4?'订单收入':d.type==6?'区域补贴':'' }}</td>
                                    </tr>
                                </tbody>
                                <tbody id="tbody_body" v-if="data_result.length==0">
                                    <tr>
                                        <td colspan="13" style="text-align:center;height:300px">
                                            <h1>没有数据</h1>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <fieldset id="gexin_page" class="layui-elem-field layui-field-title"></fieldset>
                        </div>

                        <input type=button value=后退  class="layui-btn" onclick="window.history.go(-1)">



                    </div>
                    <%};%>